package edu.kpi.pzks2.simulator.processing;

import java.util.Set;

import edu.kpi.pzks2.graph.Node;

public class Task {
    private final Node node;
    private final Set<Integer> predecessors;
    
    public Task(final Node node, final Set<Integer> predecessors) {
        this.node = node;
        this.predecessors = predecessors;
    }
    
    public int getId() {
        return node.getId();
    }
    
    public int getWeight() {
        return node.getWeight();
    }
    
    public Node getNode() {
        return node;
    }
    
    public boolean isReady(final Set<Integer> processedTasks) {
        return processedTasks.containsAll(predecessors);
    }
    
    @Override
    public String toString() {
        return "T" + node.getId() + " W=" + node.getWeight();
    }
}
